package zzs.generalframework.coder.common.model;

import java.util.Map;
import java.util.Map.Entry;

import zzs.generalframework.util.core.string.StringUtils;

/**
 * @title
 * @description
 * @project zzs-coder
 * @package zzs.generalframework.coder.common.model
 * @author zzs
 * @date 2018年1月31日
 * @version 1.0
 */
public class AnnotationInfo
{

	private String annotationName;

	private Map<String, Object> parameterMap;

	public String getAnnotationName()
	{
		return annotationName;
	}

	public void setAnnotationName(String annotationName)
	{
		this.annotationName = annotationName;
	}

	public Map<String, Object> getParameterMap()
	{
		return parameterMap;
	}

	public void setParameterMap(Map<String, Object> parameterMap)
	{
		this.parameterMap = parameterMap;
	}

	@Override
	public String toString()
	{
		StringBuffer annotationBuffer = new StringBuffer();
		annotationBuffer.append("@" + getAnnotationName());
		Map<String, Object> parameterMap = getParameterMap();
		if (parameterMap != null && parameterMap.size() > 0)
		{
			String parameter = "";
			for (Entry<String, Object> entry : parameterMap.entrySet())
			{
				parameter = entry.getKey() + "=\"" + entry.getValue() + "\",";
			}
			if (StringUtils.isNotNullAndBlank(parameter))
			{
				parameter = parameter.substring(0, parameter.length() - 1);
			}
			annotationBuffer.append("(").append(parameter).append(")");
		}
		return annotationBuffer.toString();
	}

}
